<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>类型列表</title>
<meta name="viewport" content="width=100%, initial-scale=1.0, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="/lib/weix/style/weui.min.css">
<link rel="stylesheet" href="/css/fonts.css">
<link rel="stylesheet" href="/css/comm.css">
<link rel="stylesheet" href="/css/list_user.css">
</head>

<body>
<div class="weui-search-bar" id="searchBar">
    <form class="weui-search-bar__form">
        <div class="weui-search-bar__box">
            <i class="weui-icon-search"></i>
            <input type="search" class="weui-search-bar__input" id="searchInput" placeholder="搜索" required>
            <a href="javascript:" class="weui-icon-clear" id="searchClear"></a>
        </div>
        <label class="weui-search-bar__label" id="searchText">
            <i class="weui-icon-search"></i>
            <span>搜索</span>
        </label>
    </form>
    <a href="javascript:" class="weui-search-bar__cancel-btn" id="searchCancel">取消</a>
</div>

<div class="weui-cells" id="J_list">

</div>

<div class="weui-loadmore" id="J_loadmore" style="display:none">
    <i class="weui-loading"></i>
    <span class="weui-loadmore__tips">正在加载</span>
</div>


<script src="/js/zepto.min.js"></script>
<script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
<script src="/js/comm.js"></script>
<script type="text/javascript">
function getGroupUser(){
	var id = "${id}";
	var data = {rows:1000,id:id};
	var url = "/role/role_user";

	$('#J_loadmore').show();

	$.ajax({
		type: "POST",
		dataType: 'json',
		async: false,
		contentType: "application/json; charset=utf-8",
		data: JSON.stringify(data),
		url: url,
		success: function(res){
			if(res.code == 200){
				var list = res.data.list;				
				if(list.length>0){
					for (var i =0;i<list.length;i++){

						var shtml = '<a class="weui-cell weui-cell_access no_jt" href="/userPage/user_detail/'+list[i]['id']+'">'
						if(list[i]['avatar'] != null){
						//是否已经微信登录
						shtml +=	'<div class="weui-cell__hd tbs"><img src="'+list[i]['avatar']+'" /></div>'
						}else{
						shtml +=			'<div class="weui-cell__hd tbs"><img src="/images/motoux.png" /></div>'
						}
						shtml +=			'<div class="weui-cell__bd">'+
											'<p class="cell_tit">'+list[i]['name']+'</p>'
						if(list[i]["groupName"] != null){
						shtml +=			'<p class="weui-media-box__desc">'+list[i]["groupName"]+'</p>'	
						}
						
						shtml +=	'</div>'
						//是否已经微信登录
						if(list[i]['avatar'] == null){
						shtml +=		'<div class="weui-cell__ft">未绑定</div>'
						}
						shtml +=	'</a>'

						$('#J_list').append(shtml);
					}
				}
				
				$('title').html(res.data.title) //标题赋值
				
			}else{
				weui.topTips(res.msg);
			}
		},
		error: function(e){

		},
		complete: function(e){
			$('#J_loadmore').hide();
		}
	});
}

$(function(){
	//返回本页刷新
	//window.addEventListener("pageshow", function(){
//		if(sessionStorage.getItem("yuangong")){
//			location.reload();
//			sessionStorage.removeItem("yuangong");
//		}
//	});
	//--------------------------------------------------------
	//搜索
	weui.searchBar('#searchBar');
	//--------------------------------------------------------
	getGroupUser();
});
</script>
</body>
</html>
